<!DOCTYPE HTML>
<html>

<head>
	<title>[title]</title>
	<meta charset="utf-8" />
	<meta name="viewport" content="width=device-width, initial-scale=1" />
	<!--[if lte IE 8]><script src="/static/js/ie/html5shiv.js"></script><![endif]-->
	<link rel="stylesheet" href="/static/css/main.css" />
	<script src="http://apps.bdimg.com/libs/jquery/1.11.3/jquery.min.js"></script>
	<!--[if lte IE 9]><link rel="stylesheet" href="/static/css/ie9.css" /><![endif]-->
	<!--[if lte IE 8]><link rel="stylesheet" href="/static/css/ie8.css" /><![endif]-->
	<link rel="stylesheet" href="/static/css/login.css">
	<script src="/static/js/jquery.min.js"></script>
	<script src="/static/js/jquery.min.js"></script>
	<script src="/static/js/skel.min.js"></script>
	<script src="/static/js/util.js"></script>
	<!--[if lte IE 8]><script src="/static/js/ie/respond.min.js"></script><![endif]-->
	<script src="/static/js/main.js"></script>
	<script>
		$(function () { 

			$('.loginBtn').on('click',function(){
				$('.login').removeClass('none');
				$('.register').addClass('none');
			})
			$('.registerBtn').on('click',function(){
				$('.login').addClass('none');
				$('.register').removeClass('none')
			})
			$('.x').on('click',function(){
				$('.login').addClass('none');
				$('.register').addClass('none');
			})

			
		 });
	</script>
	<script>
		$(document).ready(function() {
			$('#login-submit').on('click',function(){
				$.ajax({
					type:'POST',
					url:'/index/user/login',
					dataType:'json',
					data:{'username':$('#login .username').val(),'password':$('#login .password').val()},
					success:function(data){
						alert(data.msg);
						if(!data.type) {
							window.location.reload();
						}
					}
				});
			});
	
			$('#register-submit').on('click',function(){
				$.ajax({
					type:'POST',
					url:'/index/user/register',
					dataType:'json',
					data:{'username':$('#register .username').val(),'password':$('#register .password').val(),'repassword':$('#register .repassword').val()},
					success:function(data){
						alert(data.msg);
						if(!data.type){
							window.location.reload();
						}
					}
				});
			});
		})
	
	</script>
</head>

<body id="top" >

	<!-- Wrapper -->
	<div id="wrapper">

		<!-- Header -->
		<header id="header">
			<h1>
				<a href="/">个人信息管理网站</a>
			</h1>
			<nav class="links">
				<ul>
					<li>
						<a href="/">博客</a>
					</li>
					<li>
						<a href="/index/contacts">个人通讯录</a>
					</li>
					<li>
						<a href="/admin/index/login">网站后台管理</a>
					</li>
					<?php if($userData){ ?>
					<li>
						<a href="#">欢迎<?php echo $userData['username']; ?>登陆！<span>用户ID为<?php echo $userData['uid']; ?></span></a>
					</li>
					<li>
						<a href="/index/user/loginout" id="loginout" >注销</a>
					</li>
					<?php }else{ ?>
					<li>
						<a href="#" class="loginBtn" >登陆</a>
					</li>
					<li>
						<a href="#" class="registerBtn" >注册</a>
					</li>
					<?php } ?>
				</ul>
			</nav>
			<nav class="main">
				<ul>
					<!-- <li class="search">
						<a class="fa-search" href="#search">Search</a>
						<form id="search" method="get" action="#">
							<input type="text" name="query" placeholder="搜索" />
						</form>
					</li> -->
					<li class="menu">
						<a class="fa-bars" href="#menu">Menu</a>
					</li>
				</ul>
			</nav>
		</header>

		<!-- Menu -->
		<section id="menu">

			<!-- Search -->
			<!-- <section>
				<form class="search" method="get" action="#">
					<input type="text" name="query" placeholder="搜索" />
				</form>
			</section> -->

			<!-- Links -->
			<section>
				<ul class="links">
					<li>
						<a href="/">
							<h3>个人博客</h3>
							<p>勇敢的人不是不害怕，而是怕也要向前走。</p>
						</a>
					</li>
					<li>
						<a href="/index/contacts">
							<h3>个人通讯录</h3>
							<p>请登录后再使用，建议使用1366X768或以上的分辨率浏览</p>
						</a>
					</li>
					<li>
						<a href="/admin/index/login">
							<h3>网站后台管理</h3>
							<p>请登录后再使用，建议使用1366X768或以上的分辨率浏览</p>
						</a>
					</li>
				</ul>
			</section>

			<!-- Actions -->
			<section>
				<ul class="actions vertical">
					<?php if($userData){ ?>
					<li>
						<a href="#">欢迎<?php echo $userData['username']; ?>登陆！</a>
					</li>
					<li>
						<a href="/index/user/loginout" id="loginout" >注销</a>
					</li>
					<?php }else{ ?>
					<li>
						<a href="#" class="loginBtn" >登陆</a>
					</li>
					<li>
						<a href="#" class="registerBtn" >注册</a>
					</li>
					<?php } ?>
				</ul>
			</section>

		</section>

		<div class="login none " id="login" >
			<h3>用户登录</h3>
			<form>
				<div>
					<span>用户名：</span>
					<input class="username" type="text" placeholder="请输入用户名" >
				</div>
				<div>
					<span>密码：</span>
					<input class="password" type="password" placeholder="请输入密码" >
				</div>
				<div>
					<button type="submit" id="login-submit"  >登录</button>
				</div>
			</form>
			<i class="x"></i>
		</div>
		<div class="register none" id="register" >
				<h3>用户注册</h3>
				<form>
					<div>
						<span>用户名：</span>
						<input class="username" type="text" placeholder="请输入用户名" >
					</div>
					<div>
						<span>密码：</span>
						<input class="password" type="password" placeholder="请输入密码" >
					</div>
					<div>
						<span>确认密码：</span>
						<input class="repassword" type="password" placeholder="再次输入密码" >
					</div>
					<div>
						<button type="submit" id="register-submit" >注册</button>
					</div>
				</form>
				<i class="x"></i>
			</div>
